<%@page import="java.sql.ResultSet"%>
<%@ page import="java.util.Date" language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page session="true" %>
<%@ page contentType="text/html; charset=UTF-8" import="com.mysql.jdbc.*"%>
<%@ page contentType="text/html; charset=UTF-8" import="java.sql.Connection"%>
<%@ page contentType="text/html; charset=UTF-8" import="java.sql.DriverManager"%>
<%@ page contentType="text/html; charset=UTF-8" import="java.sql.Statement"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>

	<link rel="stylesheet" type="text/css" href="./css/style-projects-jquery.css" />
    <script type="text/javascript" src="./js/jquery-1.6.2.js"></script>
    <script type="text/javascript" src="./js/jquery.lightbox-0.5.js"></script>
    <link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />
    
    <script type="text/javascript">
    /*
    $(function() {
        $('#gallery a').lightBox();
    });
    */
    </script>
    <style type="text/css">
	#gallery {
		background-color: #444;
		padding: 10px;
		width: 520px;
	}
	#gallery ul { list-style: none; }
	#gallery ul li { display: inline; }
	#gallery ul img {
		border: 5px solid #3e3e3e;
		border-width: 5px 5px 20px;
	}
	#gallery ul a:hover img {
		border: 5px solid #fff;
		border-width: 5px 5px 20px;
		color: #fff;
	}
	#gallery ul a:hover { color: #fff; }
	</style>
</head>

<body cellspacing="0" cellpadding="0" style="padding:0;margin:0;width:540;" >

<div id="gallery">
    <ul>
<%
	
	Connection conn = null;
    Statement stmt = null;
    
    String strProjectId = request.getParameter("projectId");
    
 	int ret = 0;
 	
 	
 	
    try
    {
    	Class.forName("com.mysql.jdbc.Driver").newInstance(); 
		conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mimo" ,"root" ,"d0o9o84");
        
        stmt = conn.createStatement();
        
        ResultSet result = stmt.executeQuery("select * from imagestore where projectId='" + strProjectId + "';");
        
        while(result.next()){
        	String strImageId = result.getString("imageId");
        	
        	out.println("<li><a href='javascript:opener.insertImage(\"" + strImageId +"\");window.close();' >");
        	out.println("<img src='./getImageFile.jsp?projectId="+ strProjectId + "&imageId=" + strImageId + "' width='72' height='72' />");
        }
		
        
        stmt.close();
        conn.close();
    }
    catch( Exception ex )
    {
    	ex.printStackTrace();
    	ret = -1;
    }



%>
    </ul>
</div>
<br/><br/><br/>

</body>
</html>